package org.massdgames.thunder.server.domain.strategy;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.massdgames.thunder.server.domain.Card;
import org.massdgames.thunder.server.domain.CardType;
import org.massdgames.thunder.server.domain.Deck;

public class BasicThunderStoneLoadStrategy implements ThunderstoneLoadStrategy {

    public Deck load(Deck deck) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream("deck.properties"));

        int thunderStoneCount = new Integer(
                properties.getProperty("thunderstone.count"));

        for (int i = 0; i < thunderStoneCount; i++) {
            Card card = new Card();
            card.setCardId(i);
            card.setName(properties.getProperty("thunderstone" + i + ".name"));
            card.setCardType(CardType.THUNDERSTONE);
            deck.addCard(card);
        }

        return deck;
    }

}
